package ui.logger;

import java.util.ResourceBundle;

import javax.swing.JOptionPane;

public class AlertLogger implements LogAcceptor {

	private static final String ERROR = "error";
	private static final String INFORMATION = "information";
	private static final String WARNING = "warning";
	private static final String COMMON = "common";
	

	public void show(LogEvent le) {
		String title = "";
		int type = -1;
		switch (le.getType()) {
		case WARNING:
			title = ResourceBundle.getBundle(COMMON).getString(WARNING);
			type = JOptionPane.WARNING_MESSAGE;
			break;
		case INFORMATION:
			title = ResourceBundle.getBundle(COMMON).getString(INFORMATION);
			type = JOptionPane.INFORMATION_MESSAGE;
			break;

		case ERROR:
			title = ResourceBundle.getBundle(COMMON).getString(ERROR);
			type = JOptionPane.ERROR_MESSAGE;
			break;
		}
		JOptionPane.showMessageDialog(null, le.getMessage(), title, type);

	}

}
